package com.li.blog.controller;

import com.li.blog.service.CategoryService;
import com.li.blog.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("categorys")
public class CategoryController {

  @Autowired
  private CategoryService categoryService;

  @GetMapping
  public Result categorys(){
    return categoryService.findAll();
  }


  @GetMapping("detail")
  public Result categoriesDetail(){
    return categoryService.findAllDetail();
  }
  @GetMapping("detail/{id}")
  public Result categoriesDetail(@PathVariable Long id){
    return categoryService.categoriesDetailById(id);
  }


}
